function showstats(datastruct,ids1,ids)

% 
for i = 1 : 2
    los{i} = []; age{i} = [];
    ismale{i} = 0; isvaso{i} = 0;
    nadms{i} = 0; ishyperd{i} = 0;
    nid{i} = [];
end

for pt = ids
    if datastruct{pt}.mort == 1
        i = 2;
    elseif datastruct{pt}.mort == 0
        i = 1;
    end
    nid{i} = [nid{i} pt];
    nadms{i} = nadms{i} + 1;
    los{i} = [los{i} datastruct{pt}.los];
    age{i} = [age{i} datastruct{pt}.age];
    ismale{i} = ismale{i} + datastruct{pt}.male;
    isvaso{i} = isvaso{i} + datastruct{pt}.vaso;
    if datastruct{pt}.lvef == 4
        ishyperd{i} = ishyperd{i} + 1;
    end
end

fprintf('\nTotal number of admissions in the initial cohort: %d',length(datastruct));
fprintf('\nTotal number of admissions with data = %d (%.1f%%)',length(ids1),length(ids1)/length(datastruct)*100);
fprintf('\nTotal number of admissions with data and LoS > 1 = %d (%.1f%%)\n',length(ids),length(ids)/length(ids1)*100);
fprintf('\n Survivors (N = %d, %.1f%%):\n',nadms{1}, ...
    nadms{1}/(nadms{1} + nadms{2})*100);
fprintf('   LoS: %.1f (%.1f) [%.2f - %.2f]',mean(los{1}), ...
    std(los{1}),min(los{1}),max(los{1}));
fprintf('\n   Age: %.1f (%.1f) [%.2f - %.2f]',mean(age{1}), ...
    std(age{1}),min(age{1}),max(age{1}));
fprintf('\n   Gender (males): %d (%.1f%%)',ismale{1}, ...
    ismale{1}/nadms{1}*100);
fprintf('\n   Vaso therapy: %d (%.1f%%)',isvaso{1}, ...
    isvaso{1}/nadms{1}*100);
fprintf('\n   Hyperdynamic: %d (%.1f%%)',ishyperd{1}, ...
    ishyperd{1}/nadms{1}*100);
fprintf('\n');
fprintf('\n\n Non-Survivors (N = %d, %.1f%%):\n',nadms{2}, ...
    nadms{2}/(nadms{1} + nadms{2})*100);
fprintf('   LoS: %.1f (%.1f) [%.2f - %.2f]',mean(los{2}), ...
    std(los{2}),min(los{2}),max(los{2}));
fprintf('\n   Age: %.1f (%.1f) [%.2f - %.2f]',mean(age{2}), ...
    std(age{2}),min(age{2}),max(age{2}));
fprintf('\n   Gender (males): %d (%.1f%%)',ismale{2}, ...
    ismale{2}/nadms{2}*100);
fprintf('\n   Vaso therapy: %d (%.1f%%)',isvaso{2}, ...
    isvaso{2}/nadms{2}*100);
fprintf('\n   Hyperdynamic: %d (%.1f%%)',ishyperd{2}, ...
    ishyperd{2}/nadms{2}*100);
fprintf('\n\n');